package org.fuys.etp.core.checker;

import org.fuys.etp.core.model.res.TpConfigCheckResult;
import org.fuys.etp.core.model.res.TpStatusResult;
import org.fuys.etp.core.model.vo.TpRegulationStrategyVO;

import java.util.ArrayList;
import java.util.List;

/**
 * @projectName: fuys-etp-final
 * @package: org.fuys.etp.core.checker
 * @className: EtpUpdateCheckerChain
 * @author: WangJing
 * @description:
 * @date: 2025/2/18 16:12
 * @version: 1.0
 */
public class EtpUpdateCheckerChain {
    List<EtpUpdateChecker> etpCheckers = new ArrayList<>();

    public TpConfigCheckResult checkHandle(TpStatusResult status, TpRegulationStrategyVO strategy){
        TpConfigCheckResult result = TpConfigCheckResult.builder().extInfo("没有检查点拦截 无需更改配置")
                .needChange(false).build();
        for (EtpUpdateChecker etpChecker : etpCheckers) {
            etpChecker.checkHandle(strategy, status , result);
        }
        return result;
    }

    public void addChecker(EtpUpdateChecker checker){
        etpCheckers.add(checker);
    }
}
